import { createStore, combineReducers } from 'redux'
import { collectSet } from './reducers/collectSet'
import { loadingSet } from './reducers/loadingSet'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
//数据缓存持久化
const persistConfig = {
    //持久化配置
    key: 'root',
    storage
}
const reducers = combineReducers({
    collectSet,
    loadingSet

})

const persistedReducer = persistReducer(persistConfig, reducers)

const store = createStore(persistedReducer)
const persistor = persistStore(store)
export {
    store,
    persistor
}